
<style type="text/css">
.parent-category{float:left; width:100%; height:auto; min-height:100%;}
.parent-category ul{margin:0; padding:0; width:100%;}
.parent-category ul li{list-style:none; text-align:center; height:50px; line-height:50px; white-space:nowrap; width:100%; border-bottom:1px solid #e0e0e0; position:relative; right:-1px;}
.parent-category ul li.active{border-right:1px solid #fff; z-index: 10000}
.parent-category ul li a{color:#333; display:inline-block; width:100%; height:100%; text-decoration:none;}
.children-category{width:100%; min-height:100%; height:auto; color: #252525;}
.children-category ul{list-style:none; margin:0; padding:0; overflow-y:auto; overflow-x:hidden; border-left:1px solid #e0e0e0; min-height:100%;}
.children-category ul li{text-align:left; height: 32px; line-height: 32px; padding-left: 10px}
.children-category ul li.delivery-tips{height:25px; line-height:25px; margin-top: -15px; font-size: .65rem; color: #ff2d4b}
.children-category ul li a{display:inline-block; width:100%; height:100%; text-decoration:none; color:#333;}
.children-category ul li a span{font-size: .6rem; color: #999;}
.children-category .block{display:block; color:#ef1e15; font-size:.6rem;}
.order-create-page #addressInfo:after {
    content: ' ';
    position: absolute;
    left: 0;
    bottom: -.4rem;
    width: 100%;
    height: .8rem;
    background: url(../images/order_line.jpg) repeat-x;
    background-size: 30%;
}
.fui-footer.quick {
    background: #474749;
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
    z-index: 30;
}
.fui-footer.quick .quick-cart {
    width: 3.6rem;
    position: relative;
}
.fui-footer.quick .quick-cart.an {
    animation: cartan 0.5s;
}
@keyframes cartan {
    0% {
        transform: scale(0.8);
        -ms-transform: scale(0.8);
        -webkit-transform:scale(0.8);
        -o-transform: scale(0.8);
        -moz-transform: scale(0.8);
    }
    25% {
        transform:scale(1.1);
        -ms-transform: scale(1.1);
        -webkit-transform:scale(1.1);
        -o-transform: scale(1.1);
        -moz-transform: scale(1.1);
    }
    50% {
        transform:scale(0.9);
        -ms-transform: scale(0.9);
        -webkit-transform:scale(0.9);
        -o-transform: scale(0.9);
        -moz-transform: scale(0.9);
    }
    100% {
        transform:scale(1);
        -ms-transform: scale(1);
        -webkit-transform:scale(1);
        -o-transform: scale(1);
        -moz-transform: scale(1);
    }
}
.fui-footer.quick .quick-cart .dot {
    background: #eb0101;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 0.6rem;
    height: 0.8rem;
    line-height: 0.8rem;
    margin-left: 0.1rem;
    min-width: 0.8rem;
    padding: 0 0.2rem;
    position: absolute;
    top: -0.6rem;
    right: 0;
    vertical-align: top;
    text-align: center;
    z-index: 11;
    display: none;
}
.fui-footer.quick .quick-cart .inner {
    height: 3rem;
    width: 3rem;
    border-radius: 3rem;
    background: #ff5555;
    border: 0.25rem solid #4d4d4d;
    color: #fff;
    text-align: center;
    line-height: 2.6rem;
    position: absolute;
    right: 0;
    bottom: 0.26rem;
    z-index: 10;
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
    -webkit-box-shadow: 0 0 4px rgba(0,0,0,0.3);
    -moz-box-shadow: 0 0 4px rgba(0,0,0,0.3);
}
.fui-footer.quick .quick-cart .inner .icon {
    font-size: 1.4rem;
}
.fui-footer.quick .quick-cart.empty .inner {
    background: #404040;
    color: #67676b;
}
.fui-footer.quick .quick-info {
    width: 100%;
    padding: 0.3rem 0.4rem;
    line-height: 0.8rem;
    font-size: 0.65rem;
    color: #fff;
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    -ms-flex: 1;
    flex: 1;
}
.fui-footer.quick .quick-info .price {
    font-size: 0.9rem;
    line-height: 1rem;
}
.fui-footer.quick .quick-submit {
    height: 2.5rem;
    padding: 0 1.2rem;
    line-height: 2.5rem;
    background: #ff9d55;
    color: #fff;
    display: inline-block;
}
.fui-footer.quick .quick-submit.disabled {
    background: #5c5c5f;
}
</style>
<div class="fui-page order-create-page fui-page-current" ng-if="pagedata.op == 'main'">
    <div class="fui-header">
		<div class="fui-header-left" ng-click="goback()">
            <a class="back"></a>
        </div>
		<div class="title">确认订单</div>
		<div class="fui-header-right"></div>
	</div>
	<div class="fui-content">
        <!--地址选择-->
        <div ng-if="pagedata.order_type == 2" class="fui-list-group" id="addressInfo" style="margin: 0 0 .5rem;">
               <a id="address-show" class="fui-list">
						<div class="fui-list-media"><i class="icon jinyunicon icon-ditu"></i></div>
                        <div class="fui-list-inner" href="javascript:;" ng-click="access_json('core/member.address/')">
							<div ng-if="pagedata.addressinfo" class="text has-address">收货人：<span class="realname">{{pagedata.addressinfo.name}}</span><span class="mobile">{{pagedata.addressinfo.mobile}}</span> </div>
							<div ng-if="pagedata.addressinfo" class="text has-address"><span class="address">{{pagedata.addressinfo.pcd.province}}{{pagedata.addressinfo.pcd.city}}{{pagedata.addressinfo.pcd.district}}{{pagedata.addressinfo.address}}</span></div>
                            <div ng-if="!pagedata.addressinfo" class="text no-address"><i class="icon jinyunicon icon-jia"></i> 添加收货地址</div>
                        </div>
                        <div class="fui-list-angle">
                            <div class="angle"></div>
                        </div>
                </a>
				<div class="weui_cells weui_cells_access" style="margin-top:0">
					<a class="weui_cell" href="javascript:;" data-toggle="modal" data-target="#selecttime" ng-click="selecttime()">
						<div class="weui_cell_bd weui_cell_primary">
							<span>请选择配送时间</span>
						</div>
						<div class="weui_cell_ft" ng-model="pagedata.post.out_time">{{pagedata.post.out_time.timev || '尽快配送'}}</div>
					</a>
				</div>
         </div>
		<div ng-if="pagedata.order_type == 5" class="weui_cells_title">选择餐桌</div>
		<div ng-if="pagedata.order_type == 5" class="weui_cells weui_cells_radio">
				<label class="weui_cell weui_check_label dashed" style="padding:3px 15px" ng-repeat="item in pagedata.tables">
					<div class="weui_cell_bd weui_cell_primary">
						<span>{{item.title}}</span>
					</div>
					<div class="weui_cell_ft" ng-click="pagedata.post.group_id=item.id;pagedata.groupname=item.title;pagedata.table_list=item.table_list" data-toggle="modal" data-target="#selecttable">
						<input type="radio" class="weui_check" name="radio1">
						<span class="weui_icon_checked"></span>
					</div>
				</label>
		</div>
		<div ng-if="pagedata.order_type != 1" class="weui_cells weui_cells_form">
            <div class="weui_cell">
                <div class="weui_cell_hd"><label class="weui_label">买家留言</label></div>
                <div class="weui_cell_bd weui_cell_primary">
                    <input class="weui_input" type="text" placeholder="50字以内（选填）" ng-model="pagedata.post.remark">
                </div>
            </div>
        </div>
		<div class="weui_cells">
            <div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <span><i class="icon jinyunicon icon-dianpu"></i> {{pagedata.store.title}}</span>
                </div>
                <div class="weui_cell_ft label label-f60" style="color:#fff">{{pagedata.order_typename}}</div>
            </div>
			<div class="weui_cell" style="padding:0px 15px">
                <div class="weui_cell_bd weui_cell_primary orange">
                    <span class="bold">菜品清单</span>
                </div>
            </div>
			<div class="weui_cell_good" ng-repeat="item in pagedata.carts">
				<div class="weui_cell" style="padding:0px" >
					<div class="weui_cell_bd weui_cell_primary">
						<span>{{item.goodname}}</span>
					</div>
					<div class="weui_cell_ft">{{item.goodnum}}份 ￥{{item.goodprice}}.00</div>
				</div>
				<div class="row" style="margin:0 10px">
					<div class="jy-3" ng-repeat="p in item.packageinfo">
							<div class="yuyue-duan" style="width:auto;margin-top:0;color:#19b955">
								<div>{{p.title}} ￥{{p.price}} × {{p.num}}</div>
								<div class="clear"></div>
							</div>
					</div>
				</div>
			</div>
			<div ng-if="pagedata.order_type == 1" class="weui_cell">
				<div class="weui_cell_bd weui_cell_primary">
                    <span>用餐人数</span>
                </div>
                <div class="weui_cell_ft">
				<span ng-show="pagedata.post.user_num>1" ng-click="minusupnum();pagedata.post.user_num = pagedata.post.user_num-1;" class="minus icon jinyunicon icon-jian" style="color:#f60;font-size:1rem"></span>
				<span class="num" style="font-size:0.8rem">{{pagedata.post.user_num}}</span>
				<span ng-click="plusupnum();pagedata.post.user_num = pagedata.post.user_num+1;" class="plus icon jinyunicon icon-jia" style="color:#f60;font-size:1rem"></span>
                </div>
            </div>
			<div ng-if="pagedata.order_type == 1" class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <span>餐桌号</span>
                </div>
                <div class="weui_cell_ft">{{pagedata.tablename}}</div>
            </div>
			<div ng-if="pagedata.order_type == 2" class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <span>配送费</span>
                </div>
                <div class="weui_cell_ft">￥{{price(pagedata.store.out_pay) || '0.00'}}</div>
            </div>
			<div class="weui_cell">
                <div class="weui_cell_bd weui_cell_primary">
                    <span ng-if="pagedata.youhui >0"><i class="icon jinyunicon icon-trade" style="font-size: 0.65rem"> 优惠：￥{{pagedata.youhui || 0}}.00</i></span>
					<span ng-if="pagedata.order_type == 1"><i class="icon jinyunicon icon-kefuyouxian1" style="font-size: 0.65rem"> 茶水费：￥{{pagedata.store.in_pay || 0}}.00/位 × {{pagedata.post.user_num}}人</i></span>
                </div>
                <div class="weui_cell_ft">总计：￥<span class="red bold">{{price(pagedata.allprice)}}</span</div>
            </div>
        </div>
</div>
<div class="fui-footer quick">
	<div class="quick-info">
		<span class="price" id="cart-price" style="line-height:2.0rem;color:#fff">￥<span class="bold">{{price(pagedata.allprice)}}</span></span>
	</div>
	<div class="quick-submit" id="btn-submit" href="javascript:" ng-click="pagedata.gopay();" style="margin: 0">确认下单</div>
</div>
<div id="selecttable"  class="modal fade" tabindex="-1" style="z-index: 99999; display: none;">
	<div class="modal-dialog" style="width:90%;bottom:10%;left:5%;">
	<div class="modal-content" style="border-radius: 4px;">
		<div aria-hidden="true" data-dismiss="modal" class="closebtn"><i class="icon jinyunicon icon-wrong"></i></div>
		<div class="fui-line" style="width:6rem;margin:0.5rem auto 0 auto">
			<div class="text text-danger" style="background-color:#fff" >请选择餐桌</div>
		</div>
		<div class="row margin0" style="height:300px">
			<div class="col-xs-3">
				<div class="parent-category" id="delivery-time-parent">
					<ul>
							<li class="active"><a href="javascript:;">{{pagedata.groupname}}</a></li>
					</ul>
				</div>
			</div>
			<div class="col-xs-9">
				<div class="children-category" id="delivery-time-children">
					<div class="children-category-wrapper">
						<ul id="category1" aria-hidden="true" data-dismiss="modal">
								<li class="time-flag"><a href="javascript:;" ng-click="pagedata.selectname='现场入座'">随机餐桌 <span>(现场入座)</span></a></li>
								<li class="delivery-tips time-flag">根据人数选择餐桌</li>
								<li ng-repeat="item in pagedata.table_list" ng-click="pagedata.post.table_id=item.id;pagedata.selectname=item.title">
									<a href="javascript:;">{{item.title}} <span>({{pagedata.groupname}})</span></a>
								</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
		</div>
	</div>
</div>
<div id="selecttime" class="modal fade" tabindex="-1" style="z-index: 99999; display: none;">
	<div class="modal-dialog" style="width:90%;bottom:10%;left:5%;">
	<div class="modal-content" style="border-radius: 4px;">
		<div aria-hidden="true" data-dismiss="modal" class="closebtn"><i class="icon jinyunicon icon-wrong"></i></div>
		<div class="fui-line" style="width:6rem;margin:0.5rem auto 0 auto">
			<div class="text text-danger" style="background-color:#fff" >请选择送达时间</div>
		</div>
		<div class="row margin0" style="height:300px">
			<div class="col-xs-3">
				<div class="parent-category" id="delivery-time-parent">
					<ul>
							<li class="active" ng-repeat="(key,value) in pagedata.out_time.days"><a href="javascript:;">{{value}}</a></li>
					</ul>
				</div>
			</div>
			<div class="col-xs-9">
				<div class="children-category" id="delivery-time-children">
					<div class="children-category-wrapper">
						<ul id="category1" aria-hidden="true" data-dismiss="modal">
								<li class="time-flag"><a href="javascript:;" ng-click="pagedata.post.timev=pagedata.predict_time">尽快送达 <span>(配送费￥{{pagedata.store.out_pay}})</span></a></li>
								<li class="delivery-tips time-flag">约{{pagedata.predict_time}}送达</li>
								<li ng-repeat="item in pagedata.out_time.times" ng-click="pagedata.post.out_time.timev=item.timev" ng-class="{'hide init-hide':item.timestamp <= pagedata.timestamp}">
									<a href="javascript:;">{{item.timev}} <span>({{item.out_pay}})</span></a>
								</li>
						</ul>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>
</div>
</div>
<script type="text/javascript">
scope.pagedata.post.user_num = 2;
if(scope.pagedata.order_type == 1){
	scope.pagedata.allprice += scope.pagedata.store.in_pay * 2;
}
scope.minusupnum = function(){
		scope.pagedata.allprice -= parseInt(scope.pagedata.store.in_pay);
}
scope.plusupnum = function(){
		scope.pagedata.allprice += parseInt(scope.pagedata.store.in_pay);
}
scope.selecttable = function(item){
		var params = {
					'plugin':'jy_dish',
					'action':'order',
					'op':'selecttable',
					'query':'group_id='+item.id,
					'data':{},
					'callback':function(data){
							console.log(data)
							if(data.success == 1){
								scope.pagedata.tables = data.tables;
							}
					}
		}
		scope.post_json(params);
}
</script>
<script>
scope.pagedata.gopay=function(){
	scope.post_json('post',scope.pagedata.post,function(pay_id){
		console.log('pay_id');console.log(pay_id);
		scope.tool.pay(pay_id,function(res){
				console.log('收到支付结果！');
				if(res.type=='success'){
					scope.message('支付成功！','','jy_dish/order_show//status=10');
				}else{
					scope.message('充值失败！'+res.message,'','jy_dish/order_show//status=10');
				}
		},'','','jy_dish/order_show//status=10');
	});
}
</script>